home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / managers / mc-3.2 / mc-3 / mc-3.2.1 / vfs / extfs / zip < prev    next >
Encoding:
Text File  |  1996-05-17  |  1.3 KB  |  69 lines

  1. #! /bin/sh
  2. #
  3. # Written by Jakub Jelinek 1995
  4. #
  5. # (C) 1995 The Free Software Foundation.
  6. #
  7. #
  8. ZIP=zip
  9. UNZIP=unzip
  10. ZIPINFO="unzip -Z"
  11. #
  12. #If you don't have zipinfo, set ZIPINFO=
  13. #
  14.  
  15. mczipfs_list ()
  16. {
  17. DOZIPINFO=no
  18. if test -n "$ZIPINFO"; then
  19.     DOZIPINFO=
  20.     eval $ZIPINFO -l $1 | awk -v uid=${UID-0} '
  21. /^Archive/ { next }
  22. /^[0-9]*\ file\ / { next }
  23. /unx/ { 
  24. if ($10 ~ /^\^/)
  25.     $10=substr($10, 2)
  26. split($8, a, "-")
  27. if (a[3] < 50)
  28.     a[3] = 2000 + a[3]
  29. else
  30.     a[3] = 1900 + a[3]
  31. printf "%s   1 %-8d %-8d %8d %3s %2d %4d %s %s\n", $1, uid, 0, $4, a[2], a[1], a[3], $9, $10
  32. next
  33. }
  34. {
  35. exit 214
  36. }' 2>/dev/null
  37.     if test $? = 214; then
  38.         DOZIPINFO=no
  39.     fi
  40. fi
  41. if test -n "$DOZIPINFO"; then
  42.     eval $UNZIP -v $1 | awk -v uid=${UID-0} '
  43. BEGIN { hyphens=0 }
  44. /^Archive/ { next }
  45. /^\ Length/ { next }
  46. /^\ ------/ { if (hyphens > 0) exit 0; hyphens=1; next }
  47. if (hyphens < 1) next;
  48. if ($8 ~ /^\^/)
  49.     $8=substr($8, 2)
  50. if ($8 ~ /\/$/)
  51.     printf "drwxr-xr-x   1 %-8d %-8d %8d %s %s %s\n", uid, 0, $1, $5, $6, $8
  52. else
  53.     printf "-rw-r--r--   1 %-8d %-8d %8d %s %s %s\n", uid, 0, $1, $5, $6, $8 
  54. }' 2>/dev/null
  55. fi
  56. }
  57.  
  58. mczipfs_copyout ()
  59. {
  60.     eval $UNZIP -p $1 $2 > $3 2>/dev/null
  61. }
  62.  
  63. case "$1" in
  64.   list) mczipfs_list $2; exit 0;;
  65.   copyout) mczipfs_copyout $2 $3 $4; exit 0;;
  66. esac
  67. exit 1
  68.